package com.job.admin.audit.controller;

import com.job.admin.audit.service.AuditCompanyService;
import com.job.admin.model.audit.dto.AuditAvatarPageDto;
import com.job.admin.model.audit.dto.AuditCompanyPageDto;
import com.job.client.common.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/admin/audit/company")
@Api(tags = "审核公司接口文档")
public class AuditCompanyController {
    @Autowired
    private AuditCompanyService auditCompanyService;

    @PostMapping("/list/{page}/{size}")
    @ApiOperation("获得公司审核分页数据")
    public ResponseResult getList(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @RequestBody AuditCompanyPageDto dto
    ){
        return auditCompanyService.getList(page,size,dto);
    }

    @GetMapping("/userInfo")
    @ApiOperation("获得公司审核用户信息")
    public ResponseResult getUserInfo(@RequestParam String userId){
        return auditCompanyService.getUserInfo(userId);
    }

    @GetMapping("/auditSuccess")
    @ApiOperation("公司审核成功")
    public ResponseResult auditSuccess(@RequestParam String auditCompanyId,@RequestParam String userNumber){
        return auditCompanyService.auditSuccess(auditCompanyId,userNumber);
    }

    @GetMapping("/{auditCompanyId}")
    @ApiOperation("通过id获得公司审核结果数据")
    public ResponseResult getCompanyResultById(@PathVariable String auditCompanyId){
        return auditCompanyService.getCompanyResultById(auditCompanyId);
    }

    @GetMapping("/auditError")
    @ApiOperation("公司审核失败")
    public ResponseResult auditError(
            @RequestParam String auditCompanyId,
            @RequestParam String userNumber,
            @RequestParam String errorMessage){
        return auditCompanyService.auditError(auditCompanyId,userNumber,errorMessage);
    }
    @GetMapping("/getAuditInfo")
    @ApiOperation("获得该用户未审核的数据")
    public ResponseResult getAuditInfo(@RequestParam String userId){
        return auditCompanyService.getAuditInfo(userId);
    }
}
